Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable strict concurrency #14

Merged
merged 4 commits into from
Jul 12, 2024
Merged

Enable strict concurrency #14

merged 4 commits into from
Jul 12, 2024

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Jul 10, 2024

Enable strict concurrency

♻️ Current situation & Problem

This PR enables strict concurrency for the project and fixes resulting concurrency warnings.

⚙️ Release Notes

  • Comply with strict concurrency

📚 Documentation

--

✅ Testing

--

Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@Supereg Supereg requested a review from PSchmiedmayer July 10, 2024 11:29
@Supereg
Copy link
Member Author

Supereg commented Jul 10, 2024

Xcode 15 triggers concurrency warnings that are no longer triggered in Xcode 16 beta 3.

Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the improvements @Supereg!

@PSchmiedmayer PSchmiedmayer added the enhancement New feature or request label Jul 12, 2024
Copy link

codecov bot commented Jul 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.34%. Comparing base (51da340) to head (8dd4833).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #14      +/-   ##
==========================================
+ Coverage   90.69%   91.34%   +0.66%     
==========================================
  Files           8        8              
  Lines         279      300      +21     
==========================================
+ Hits          253      274      +21     
  Misses         26       26              
Files Coverage Δ
...untimeAssertions/XCTRuntimeAssertionInjector.swift 75.35% <100.00%> (+9.96%) ⬆️
.../XCTRuntimeAssertions/XCTRuntimePrecondition.swift 97.98% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 51da340...8dd4833. Read the comment docs.

@Supereg Supereg merged commit 2ebbbb4 into main Jul 12, 2024
10 checks passed
@Supereg Supereg deleted the feature/strict-concurrency branch July 12, 2024 07:34
Supereg added a commit that referenced this pull request Jul 15, 2024
# Lie to the Swift compiler about isolation

## ♻️ Current situation & Problem
In PR #14 we truthfully implemented strict concurrency checking for the
XCTRuntimeAssertions library. However, this made it impossible to test
runtime precondition failures on the `@MainActor` as it would completely
block the actor (or the Task would only be scheduled after the
`XCTRuntimePrecondition` call returned).
Therefore, it is necessary to always run `XCTRuntimePrecondition`
expressions on a background thread. If we would keep correct `@Sendable`
annotations for the expression closure, this would make it impossible to
run `XCTRuntimePrecondition`s on the `@MainActor`. Therefore, we lie to
the compiler. We deliberately don't annotate the expression closure as
`@Sendable` and silence the respective concurrency warning.
The impact of that is documented.

## ⚙️ Release Notes 
* Restore testing preconditions which are annotated to be isolated to
the `@MainActor`.


## 📚 Documentation
Add documentation bubbles to explain the impact.


## ✅ Testing
Add unit testing to prevent regressions.


### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants